import java.util.function.Supplier;

/**
 * @time 2020/9/10
 * @auth Gotcha
 * @describe
 */
public enum CarType {
    FORD(()->new Ford()),
    FERRARI(Ferrari::new);

    private final Supplier<Car> constructor;

    CarType(Supplier<Car> constructor) {
        this.constructor = constructor;
    }

    public Supplier<Car> getConstructor() {
        return this.constructor;
    }
}
